package mobile.map;

import java.util.ArrayList;

import mobile.map.FHMinToast;

import android.graphics.drawable.Drawable;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapActivity;
import com.google.android.maps.OverlayItem;

public class FHMinOverlay extends ItemizedOverlay<OverlayItem> {

	private static ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
	MapActivity myMA;


	public FHMinOverlay(Drawable defaultMarker, MapActivity ma) {
		super(boundCenterBottom(defaultMarker));
		myMA = ma;
		// TODO Auto-generated constructor stub
	}

	@Override
	protected OverlayItem createItem(int i) {
		// TODO Auto-generated method stub
		return mOverlays.get(i);
	}

	@Override
	public int size() {
		// TODO Auto-generated method stub
		return mOverlays.size();
	}

	public void addOverlay(OverlayItem overlay) {
		mOverlays.add(overlay);
		populate();
	}
	
	public void clear() {
		mOverlays.clear();
		populate();
	}

	// Handle tap events on overlay icons
	@Override
	protected boolean onTap(int i){		
		FHMinToast.ShowText( myMA, mOverlays.get(i).getTitle());
		return(true);
	}
}
